#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, H, M;
    cin >> N >> H >> M;

    vector<pair<int, int>> monsters(N);
    for (int i = 0; i < N; ++i) {
        cin >> monsters[i].first >> monsters[i].second;
    }

    // Initialize DP table
    vector<vector<int>> dp(H + 1, vector<int>(M + 1, -1));
    dp[H][M] = 0;
    int max_defeated = 0;

    for (const auto [a,b] : monsters) 
    {
        
        vector<vector<int>> new_dp = dp;

        for (int h = 0; h <= H; ++h) 
        {
            for (int m = 0; m <= M; ++m) 
            {
                if (dp[h][m] == -1) continue;

                // Option 1: defeat with health
                if (h >= a) 
                {
                    if (new_dp[h - a][m] < dp[h][m] + 1) {
                        new_dp[h - a][m] = dp[h][m] + 1;
                    }
                }

                // Option 2: defeat with magic
                if (m >= b) {
                    if (new_dp[h][m - b] < dp[h][m] + 1) {
                        new_dp[h][m - b] = dp[h][m] + 1;
                    }
                }
            }
        }

        dp = move(new_dp);

        // Update max_defeated
        for (int h = 0; h <= H; ++h) {
            for (int m = 0; m <= M; ++m) {
                if (dp[h][m] > max_defeated) {
                    max_defeated = dp[h][m];
                }
            }
        }
    }

    cout << max_defeated << '\n';

    return 0;
}